package com.shuiyun.weobo.config;


import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Bean;

import java.io.IOException;

/**
 * @program: weibo
 * @description:
 * @author: shuiyun
 * @create: 2020-04-26 22:20
 **/
@org.springframework.context.annotation.Configuration
public class HBaseConfig {

    @Bean("connection")
    public Connection connection() throws IOException {
        Configuration configuration = HBaseConfiguration.create();
        configuration.set("hbase.zookeeper.quorum","hadoop01:2181,hadoop02:2181,hadoop03:2181");
        Connection connection = ConnectionFactory.createConnection(configuration);
        return connection;
    }
}
